﻿Imports ArtNoi

Public Class WebLogger

    Public Shared Sub [Error](ByRef _request As HttpRequest, ByRef _session As HttpSessionState, ByVal _exception As Exception)

        Try

            Dim _comandos As String = String.Empty
            Dim _usuario As String = String.Empty
            Dim _pagina As String = _request.ServerVariables("HTTP_HOST") & _request.ServerVariables("URL") & "?" & _request.ServerVariables("QUERY_STRING")
            Dim _httpReferer As String = _request.ServerVariables("HTTP_REFERER")
            Dim _remoteAddress As String = _request.ServerVariables("REMOTE_ADDR")
            Dim _erro As ErrorLog

            _session("LastError") = _exception

            _erro = New ErrorLog(_exception, _usuario)
            _erro.StackTrace = "User-agent " & _request.UserAgent & " : " & _erro.StackTrace & " >>> " & _comandos
            _erro.REMOTE_ADDR = _remoteAddress
            _erro.HTTP_REFERER = _httpReferer
            _erro.Pagina = _pagina

            _erro.Salvar()

        Finally

        End Try


    End Sub

End Class
